package com.oocl.sc.service.impl;

import com.oocl.sc.dao.ScartDao;
import com.oocl.sc.dao.impl.ScartDaoImpl;
import com.oocl.sc.service.ScartService;

public class ScartServiceImpl implements ScartService {

	 private ScartDao scartDao = new ScartDaoImpl();
	
	public int updateMenu(String account, String menulist) {
		try {
			int m = scartDao.isAccountExisted(account);
			if (m == 1) {
				scartDao.updateMenu(account, menulist);
			}else{
				scartDao.addMenu(account, menulist);
			}
			return 1;
		} catch (Exception e) {
			e.printStackTrace();
			return 0;			
		}
	}

	public String loadScartByAccount(String account) {
		return scartDao.loadScartByAccount(account);
	}

	public int deleteMenu(String account) {
		int m = scartDao.deleteMenu(account);
		return m;
	}
	
	

}
